<template>
    <div>
       <!--面包屑功能-->
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>权限管理</el-breadcrumb-item>
        <el-breadcrumb-item>权限列表</el-breadcrumb-item>
      </el-breadcrumb>
    <!--卡片区-->
    <el-card>
      <el-table
      :data="rightList"
      border
      stripe
      style="width: 100%">
      <el-table-column
      type="index" label="#">
    </el-table-column>
      <el-table-column
        prop="authName"
        label="权限名称"
        width="180">
      </el-table-column>
      <el-table-column prop="path" label="路径">
      </el-table-column>
      <el-table-column
        label="权限等级" width="80">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.level==0" size="small ">一级</el-tag>
          <el-tag type="info" v-else-if="scope.row.level==1" size="small ">二级</el-tag>
          <el-tag type="warning" v-else size="small ">三级</el-tag>
        </template>
      </el-table-column>
    </el-table>
    </el-card>
    </div>
</template>

<script>
export default {
  data () {
    return {
      rightList: []
    }
  },
  created() {
    // 调用读取数据
    this.getRightList()
  },
  methods: {
    indexMethod(index) {
      return index + 1
    },
    // 异步读取数据
    async getRightList() {
      console.log('============')
      const { data: res } = await this.$http.get('/rights?type=list')
      console.log(res)
      if (res.meta.status !== 200) {
        return this.$message.warning('获取信息出错')
      }
      // 设置数据
      this.rightList = res.data
    }
  },
  computed: {
  }
}
</script>

<style scoped lang="less">

</style>
